﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HKEA.CMS.Core.IDAL.Tbl;
using HKEA.CMS.Core.Models;
using HKEA.CMS.Core.DALFactory;
using HKEA.CMS.Core.Utility;
using HKEA.CMS.Core.IDAL.App;

namespace HKEA.CMS.Core.BLL.App
{
    public class app_tblCust_ProdCatBLL
    {
        private Iapp_tblCust_ProdCat IDAL;
        public app_tblCust_ProdCatBLL()
        {
            IDAL = DataAccess.CreateIapp_tblCust_ProdCat();
        }

        public static app_tblCust_ProdCatBLL GetInstance()
        {
            return new app_tblCust_ProdCatBLL();
        }

        /// <summary>
        /// 插入一条数据
        /// </summary>
        /// <param name="ent"></param>
        /// <returns></returns>
        public int InsertENT(app_tblCust_ProdCat ent)
        {
            int ret = 0;
            if (ent != null)
            {
                try
                {
                    ret = IDAL.InsertENT(ent);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return ret;
        }
        /// <summary>
        /// 获取一个分页的List对象
        /// </summary>
        /// <param name="ent"></param>
        /// <param name="param"></param>
        /// <param name="strPropertyName"></param>
        /// <param name="strOrderBy"></param>
        /// <returns></returns>
        public List<app_tblCust_ProdCat> GetListByENT(app_tblCust_ProdCat ent, PageParam param, string strPropertyName, string strOrderBy)
        {
            List<app_tblCust_ProdCat> list = new List<app_tblCust_ProdCat>();
            if (ent != null && param != null)
            {
                try
                {
                    list = IDAL.GetListByENT(ent, param, strPropertyName, strOrderBy);
                }
                catch (Exception)
                { throw; }
            }
            return list;
        }
        /// <summary>
        /// 根据实体获取一个List对象
        /// </summary>
        /// <param name="ent"></param>
        /// <returns></returns>
        public List<app_tblCust_ProdCat> GetListByENT(app_tblCust_ProdCat ent)
        {
            List<app_tblCust_ProdCat> list = new List<app_tblCust_ProdCat>();
            if (ent != null)
            {
                try
                {
                    list = IDAL.GetListByENT(ent);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return list;
        }
        /// <summary>
        /// 获取当前的总记录数
        /// </summary>
        /// <param name="ent"></param>
        /// <returns></returns>
        public int GetCountByENT(app_tblCust_ProdCat ent)
        {
            int ret = 0;
            if (ent != null)
            {
                try
                {
                    ret = IDAL.GetCountByENT(ent);
                }
                catch
                {
                    throw;
                }
            }
            return ret;
        }
        /// <summary>
        /// 根据实体更新一条数据
        /// </summary>
        /// <param name="ent"></param>
        /// <returns></returns>
        public int UpdateENT(app_tblCust_ProdCat ent)
        {
            int ret = 0;
            if (ent != null)
            {
                try
                {
                    ret = IDAL.UpdateENT(ent);
                }
                catch (Exception)
                { throw; }
            }
            return ret;
        }
        /// <summary>
        /// 根据实体删除一条数据
        /// </summary>
        /// <param name="ent"></param>
        /// <returns></returns>
        public int DeleteENT(app_tblCust_ProdCat ent)
        {
            int ret = 0;
            if (ent != null)
            {
                try
                {
                    ret = IDAL.DeleteENT(ent);
                }
                catch (Exception)
                { throw; }
            }
            return ret;
        }

        public List<int> GetCustomerUIDList()
        {
            try { return IDAL.GetCustomerUIDList(); }
            catch (Exception er) { }
            return null;
        }
    }
}
